#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> pii;
// priority_queue<int, vector<int>, less<int>> pq;

void solve() {
    int n, k;
    cin >> n >> k;
    if(n == 1){
        cout << k << endl;
        return;
    } else if(n == 2) {
        cout << k << ' ' << k << endl;
        return;
    }else if(n == 3) {
        cout << k << ' ' << 0 << ' ' << k << endl;
        return;
    }
    vector<int> ans(n + 1);
    ans[1] = k, ans[n] = k;
    int t = sqrt(n);
    if(t * t > k) t--;
    int p = n - t * t;
    if(t & 1) {
        int l = 2, r = n - 1;
        for(int i = 0; i < p; i++) {
            ans[l] = ans[r] = k;
            l++, r--;
        }
    }else{
        p--;
        int l = 2, r = n - 1;
        for(int i = 0; i < p; i++) {
            ans[l] = ans[r] = k;
            l++, r--;
        }
    }
    
    // ans.push_back(k);
    // int t = 0;
    // if(n % 2 == 0) t = k;
    // for(int i = 0; i < n - 2; i++) ans.push_back(t);
    // if(n > 1) ans.push_back(k);
    for(int i = 1; i <= n; i++) cout << ans[i] << ' ';
    cout << endl;
}

signed main() {
    int t; cin >> t;
    while(t--) solve();
    return 0;
}